import { useDict } from '@/utils/dict'
import { handleTree } from '@/utils/ruoyi'
import useCommonStore from '@/store/modules/common'
import { getOrdprojectNoPriv } from '@/api/projectManage/project'
import { listBySupplierrName } from '@/api/sourceModules/supplier'
import { contractInfoListNoPriv } from '@/api/salesManage/contractManage/index'
import {
  getListByCustomerName,
  getDetailTactlistByCactName
} from '@/api/customerManage/customerList'
import { listSalesOrderSelect } from '@/api/indentManage/indent'
import { getListWarehouse } from '@/api/warehouseManage/warehouse'
import { ElMessage } from 'element-plus'
import useUserStore from '@/store/modules/user'
import { treeselectNoPriv } from '@/api/rsgl/zzjg'
import { parseTime, selectDictLabel } from '@/utils/ruoyi'
import { deepClone } from '@/utils'

const userStore = useUserStore()
const commonStore = useCommonStore()
/*** 获取字典*/
export const {
  order_business_type, //订单业务分类
  order_status, //订单状态
  order_biz_type, //业务类型
  order_source, //订单来源
  invoice_status, //发票状态
  order_price, //订单金额
  yes_or_no, //是否
  warehouse_info, //仓库信息
  pay_type, //付款方式
  measurement_unit, //单位
  improve_form, //提升形式
  order_library, //培训产业继续教育所属库
  library_status, //入库情况
  membership_level, //会员等级
  online_offline, //线上/线下
  train_course_name, //培训课程名称
  invoice_manage_type, //订单发票类型
  invoice_header, //发票抬头类型
  invoice_method, //开票方式
  product_property, //产品属性
  order_property, //订单属性
  order_transport_type, //订单货运方式
  order_indemnity_percent, //订单违约赔偿率
  order_transport_man, //订单运费承担方
  order_sell_group, //订单销售分组
  order_agency_dept, //订单代理机构
  transaction_type, //往来业务类型
  order_pro_type, //订单产品类型
  order_charge_type, //订单收费方式
  order_bank_card, //订单收款账号
  rsgl_ygda_highest_degree, //最高学历
  order_imports_exports_type, //订单进出口类型
  educational_system, //学制
  graduation_status, //毕业情况
  order_hierarchy, //层次
  have_certificate, //有无证件
  order_process, //订单业务流程
  settle_type, //结算方式
  international_operate_type, //国际化经营类型
  inner_biz_type, //内部交易业务类型
  bidding_unit, //内部单位
  process_approve_status, //流程审批状态
  order_synchronous_status, // 订单同步的状态
  enter_date, //入学时间
  certificate_name, //报考证书名称
  nuonuo_contract_status, //诺诺合同状态
  nuonuo_contract_type, //合同类型
  order_invoice_status, //订单发票状态
  supervision_approval, //审核结果
  customer_star, //客户星级
  crm_status, //crm状态
  nuonuo_status, //诺诺、爱企服状态
  order_authority_type, //订单权限类型
  customer_level, //客户等级
  tax_grade, //纳税人等级
  keep_account_type, //代理记账业务分类
  keep_account_content //代账服务内容
} = useDict(
  'order_business_type',
  'order_status',
  'order_biz_type',
  'order_source',
  'invoice_status',
  'order_price',
  'yes_or_no',
  'warehouse_info',
  'pay_type',
  'measurement_unit',
  'improve_form',
  'order_library',
  'library_status',
  'membership_level',
  'online_offline',
  'train_course_name',
  'invoice_manage_type',
  'invoice_header',
  'invoice_method',
  'product_property',
  'order_property',
  'order_transport_type',
  'order_indemnity_percent',
  'order_transport_man',
  'order_sell_group',
  'order_agency_dept',
  'transaction_type',
  'order_pro_type',
  'order_charge_type',
  'order_bank_card',
  'rsgl_ygda_highest_degree',
  'order_imports_exports_type',
  'educational_system',
  'graduation_status',
  'order_hierarchy',
  'have_certificate',
  'order_process',
  'settle_type',
  'international_operate_type',
  'inner_biz_type',
  'bidding_unit',
  'process_approve_status',
  'order_synchronous_status',
  'enter_date',
  'certificate_name',
  'nuonuo_contract_status',
  'nuonuo_contract_type',
  'order_invoice_status',
  'supervision_approval',
  'customer_star',
  'customer_level',
  'crm_status',
  'nuonuo_status',
  'order_authority_type',
  'tax_grade',
  'keep_account_type',
  'keep_account_content'
)

export const invoice_manage_type_order = computed(() => {
  return invoice_manage_type.value.filter(
    item => item.value == '6' || item.value == '7'
  )
}) //订单发票类型

// 子表公用配置
export const crudOption = {
  header: true,
  menu: true,
  menuFixed: 'right',
  delBtn: false,
  editBtn: false,
  addBtn: false,
  addRowBtn: false,
  saveBtn: false,
  cancelBtn: false,
  cellBtn: false,
  // searchBtn: false,
  refreshBtn: false,
  columnBtn: false,
  menuWidth: 100,
  border: true
}

/***所属公司 数据*/
export const companyOption = ref([])
/***所属公司无权限 数据*/
export const companyNoPrivOption = ref([])
/***归属部门*/
export const departmentOption = ref([])
/***当前公司所有部门无权限*/
export const departmentNoPrivOption = ref([])
/***部门树结构*/
export const deptTreeOption = ref([])
/***部门人员*/
export const userTreeOption = ref([])
/***所属税局*/
export const taxTreeOption = ref([])
// 业务类型
export const businessTypeOption = ref([])
// 报考证书名称
export const certificateName = ref([])
// 用户业务类型
export const userBusinessTypeOption = ref([])

export const loadingSelect = ref(false) //检索的loading

/***所属企业/客户名称数据 start*/
export const parentOptions = ref([]) //所属企业/客户名称数据
/**
 * 所属企业模糊搜索
 * @param val 当前输入的值
 */
export async function queryCustomer(val) {
  if (!val) {
    return
  }
  let params = {
    pageSize: 10,
    customer: val
  }
  loadingSelect.value = true
  await getListByCustomerName(params).then(res => {
    parentOptions.value = res.data
    loadingSelect.value = false
    console.log(parentOptions.value, 'parentOptions.value ')
  })
}

/***供应商名称数据 start*/
export const supplierOptions = ref([]) //供应商数据
/**
 * 供应商模糊搜索
 * @param val 当前输入的值
 */
export async function querySupplier(val) {
  if (!val) {
    return
  }
  let params = {
    pageSize: 10,
    supplierName: val
  }
  loadingSelect.value = true
  await listBySupplierrName(params).then(res => {
    supplierOptions.value = res.data
    loadingSelect.value = false
    console.log(supplierOptions.value, 'supplierOptions.value ')
  })
}

/***项目列表数据---根据客户id检索的结果*/
export const projectOptionsLimitEnt = ref([])
/**
 * 管理项目模糊搜索--根据客户id检索
 * @param val 当前输入的值
 */
export async function queryProjectLimitEnt(val, entId, mes) {
  // if (!val) {
  //   return
  // }
  if (!entId) {
    ElMessage({
      type: 'error',
      message: mes ? mes : '请先选择客户'
    })
    console.log('请先选择客户')
    return
  }
  let params = {
    pageSize: 10,
    cusId: entId,
    proName: val
  }
  loadingSelect.value = true
  await getOrdprojectNoPriv(params).then(res => {
    projectOptionsLimitEnt.value = res.rows
    loadingSelect.value = false
    console.log(projectOptionsLimitEnt.value, 'projectOptionsLimitEnt.value ')
  })
}

/***项目列表数据--不限制*/
export const projectOptions = ref([])
/**
 * 管理项目模糊搜索--不限制
 * @param val 当前输入的值
 */
export async function queryProject(val) {
  if (!val) {
    return
  }
  let params = {
    pageSize: 10,
    proName: val
  }
  loadingSelect.value = true
  await getOrdprojectNoPriv(params).then(res => {
    projectOptions.value = res.rows
    loadingSelect.value = false
    console.log(projectOptions.value, 'projectOptions.value ')
  })
}

/***合同列表数据---根据客户id检索的结果*/
export const contractOptionsLimitEnt = ref([])
/**
 * 合同模糊搜索--根据客户id检索
 * @param val 当前输入的值
 */
export async function queryContractLimitEnt(val, entId, mes) {
  // if (!val) {
  //   return
  // }
  if (!entId) {
    ElMessage({
      type: 'error',
      message: mes ? mes : '请先选择客户'
    })
    console.log('请先选择客户')
    return
  }
  let params = {
    pageSize: 10,
    partya: entId,
    contractNameOrNum: val
  }
  loadingSelect.value = true
  await contractInfoListNoPriv(params).then(res => {
    contractOptionsLimitEnt.value = res.data.records
    loadingSelect.value = false
    console.log(contractOptionsLimitEnt.value, 'contractOptionsLimitEnt.value ')
  })
}

/***合同列表数据--不限制*/
export const contractOptions = ref([])
/**
 * 合同模糊搜索--不限制
 * @param val 当前输入的值
 */
export async function queryContract(val) {
  if (!val) {
    return
  }
  let params = {
    pageSize: 10,
    contractNameOrNum: val
  }
  loadingSelect.value = true
  await contractInfoListNoPriv(params).then(res => {
    contractOptions.value = res.data.records
    loadingSelect.value = false
    console.log(contractOptions.value, 'contractOptions.value ')
  })
}

/***客户联系人数据---根据客户id检索的结果  start*/
export const contactsOptionsLimitEnt = ref([])
/**
 * 客户联系人模糊搜索--根据客户id检索
 * @param val 当前输入的值
 * @param entId 客户id
 * @param mes 错误提示信息
 */
export async function queryContactsLimitEnt(val, entId, mes, contactsId) {
  if (!val) {
    return
  }
  if (entId !== '') {
    if (!entId) {
      ElMessage({
        type: 'error',
        message: mes ? mes : '请先选择客户'
      })
      console.log('请先选择客户')
      return
    }
  }

  let params = {
    pageSize: 10,
    entId: entId,
    contactName: val,
    ids: contactsId || ''
  }
  loadingSelect.value = true
  await getDetailTactlistByCactName(params).then(res => {
    contactsOptionsLimitEnt.value = res.data
    loadingSelect.value = false
  })
}

/***客户联系人数据---不限制  start*/
export const contactsOptions = ref([])
/**
 * 客户联系人模糊搜索--不限制
 * @param val 当前输入的值
 * @param entId 客户id
 * @param mes 错误提示信息
 */
export async function queryContacts(val) {
  if (!val) {
    return
  }
  let params = {
    pageSize: 10,
    entId: '',
    contactName: val
  }
  loadingSelect.value = true
  await getDetailTactlistByCactName(params).then(res => {
    contactsOptions.value = res.data
    loadingSelect.value = false
  })
}

/***仓库数据---根据条件检索的结果  start*/
export const whsOptLimitEnt = ref([])
// 仓库模糊检索--根据条件检索
export function queryWhsLimitEnt(val, queryParams, mes) {
  console.log('val==>', val)
  // if (!val) {
  //   return
  // }
  console.log('val, entId,', val, queryParams)
  loadingSelect.value = true
  let params = {
    pageNum: 1,
    pageSize: 10,
    name: val,
    ...queryParams
  }
  getListWarehouse(params).then(res => {
    loadingSelect.value = false
    whsOptLimitEnt.value = res.rows
  })
}

/***订单数据---根据客户id检索的结果  start*/
export const indentOptionLimitEnt = ref([])
// 订单模糊检索--根据客户id检索
export function queryIndentLimitEnt(val, entId, mes) {
  // if (!val) {
  //   return
  // }
  console.log('val, entId,', val, entId)
  if (entId !== '') {
    if (!entId) {
      ElMessage({
        type: 'error',
        message: mes ? mes : '请先选择客户'
      })
      console.log('请先选择客户')
      return
    }
  }
  loadingSelect.value = true
  let params = {
    pageNum: 1,
    pageSize: 10,
    customerId: entId,
    title: val
  }
  listSalesOrderSelect(params).then(res => {
    loadingSelect.value = false
    indentOptionLimitEnt.value = res.rows
  })
}

/***订单数据---不限制  start*/
export const indentOption = ref([])
// 订单模糊检索--不限制
export function queryIndent(val) {
  if (!val) {
    return
  }
  loadingSelect.value = true
  let params = {
    pageNum: 1,
    pageSize: 10,
    title: val
  }
  listSalesOrderSelect(params).then(res => {
    loadingSelect.value = false
    indentOption.value = res.rows
  })
}

initFn()
async function initFn() {
  let response = await commonStore.getCompanyData()
  companyOption.value = response //proxy.handleTree(response, 'deptId')
  let department = await commonStore.getDepartmentData()
  departmentOption.value = department //proxy.handleTree(response, 'deptId')
  let departmentNoPriv = await treeselectNoPriv({
    deptId: userStore.userInfo.orgId
  })
  departmentNoPrivOption.value = departmentNoPriv.data //proxy.handleTree(response, 'deptId')
  let companyNoPriv = await treeselectNoPriv({
    deptType: 1
  })
  companyNoPrivOption.value = companyNoPriv.data
  let deptTree = await commonStore.getDeptTreeData()
  deptTreeOption.value = deptTree //proxy.handleTree(response, 'deptId')
  let userTree = await commonStore.getUseTreeData()
  userTreeOption.value = userTree //proxy.handleTree(response, 'deptId')
  let taxTree = await commonStore.getTaxTreeData()
  taxTreeOption.value = taxTree //proxy.handleTree(response, 'deptId')
}
/*商机列表跳转过来合同（ 修改业务数据）  gbq  2024/6/19 start*/
export const businessParams = ref({})
/*商机列表跳转过来  end*/
watchEffect(
  () => {
    if (order_business_type.value.length > 0) {
      // let types = toRaw(order_business_type.value)
      let types = deepClone(order_business_type.value)
      // console.log('types==>', types)
      // businessTypeOption.value = handleTree(types, 'value')
      // console.log('businessTypeOption.value==>', businessTypeOption.value)

      let certificateName1 = toRaw(certificate_name.value)
      certificateName.value = handleTree(deepClone(certificateName1), 'value')
      // console.log('certificateName==>', certificateName)

      let businessSector = userStore.userInfo.businessSector
        ? userStore.userInfo.businessSector.split(',')
        : [] //人员所属业务板块信息 businessSector
      let businessSectorOption = types.filter(e => {
        return businessSector.indexOf(e.value) !== -1
      })

      // let businessSectorOption = types
      userBusinessTypeOption.value = handleTree(
        deepClone(businessSectorOption),
        'value'
      )
      if (
        businessParams.value.type &&
        businessParams.value.type == 'business'
      ) {
        let allData = handleTree(deepClone(types), 'value')
        let val = '财税大客户销售,大客户运维'

        let labels = val.split(',')
        let newData = []
        allData.forEach(item => {
          if (item.children) {
            item.children.forEach(child => {
              if (labels.includes(child.label)) {
                newData.push({
                  children: child.children,
                  elTagClass: child.elTagClass,
                  elTagType: child.elTagType,
                  label: child.label,
                  parentId: child.parentId,
                  remark: child.remark,
                  value: child.value
                })
              }
            })
          } else {
            if (labels.includes(item.label)) {
              newData.push({
                children: item.children,
                elTagClass: item.elTagClass,
                elTagType: item.elTagType,
                label: item.label,
                parentId: item.parentId,
                remark: item.remark,
                value: item.value
              })
            }
          }
        })
        businessTypeOption.value = newData
      } else {
        businessTypeOption.value = handleTree(deepClone(types), 'value')
      }
    }
  },
  { flush: 'post' }
)
/***所属公司  end*/

// 销售订单列表配置
export const SALESORDERTABLE = [
  // {
  //   show: true,
  //   type: 'index',
  //   width: '40',
  //   label: '序号',
  //   align: 'center',
  //   fixed: 'left'
  // },
  {
    show: true,
    prop: 'contractOrderNumber',
    label: '合同(订单)编号',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'customerName',
    label: '关联客户',
    align: 'center',
    minWidth: 200,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'price',
    label: '订单总金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.price ? `${row.price}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'repaymentPrice',
    label: '已回款金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.repaymentPrice ? `${row.repaymentPrice}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'invoiceStatus',
    label: '发票状态',
    align: 'center',
    minWidth: 130,
    tooltip: row => {
      return row.invoiceMsg
    },
    tooltipVal: row => {
      return selectDictLabel(order_invoice_status.value, row.invoiceStatus)
    }
  },
  {
    show: true,
    prop: 'invoicePrice',
    label: '已开票金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.invoicePrice ? `${row.invoicePrice}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'status',
    label: '状态',
    align: 'center',
    minWidth: 140,
    formatter: row => {
      return `${selectDictLabel(order_status.value, row.status)}${
        row.approvalStatus ? `( ${row.approvalStatus})` : ''
      }`
    }
  },
  {
    show: true,
    prop: 'transactionName',
    label: '销售人员',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'customerCreditCode',
    label: '税号',
    align: 'center',
    minWidth: 200
  },
  {
    show: true,
    prop: 'receiptsDate',
    label: '单据日期',
    align: 'center',
    minWidth: 110
  },
  {
    show: true,
    prop: 'businessType',
    label: '业务板块',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return selectDictLabel(order_business_type.value, row.businessType)
    }
  },
  {
    show: true,
    prop: 'synchronousMsg',
    label: 'A8同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'createTime',
    label: '订单创建时间',
    align: 'center',
    minWidth: 130
  },
  {
    show: true,
    prop: 'approvalTime',
    label: '最新审批时间',
    align: 'center',
    minWidth: 130
  },
  {
    show: true,
    prop: 'source',
    label: '订单来源',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return selectDictLabel(order_source.value, row.source)
    }
  },
  {
    show: true,
    prop: 'productName',
    label: '产品名称',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'orgName',
    label: '所属公司',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'deptName',
    label: '所属部门',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'invoiceTypeName',
    label: '发票类型',
    align: 'center',
    minWidth: 100,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'crmMsg',
    label: 'CRM同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'nuonuoMsg',
    label: '诺诺同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'aisinoMsg',
    label: '诺企服同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  }
]
// 销售订单开票列表配置
export const ORDERINVOICETABLE = [
  {
    show: true,
    prop: 'contractOrderNumber',
    label: '合同(订单)编号',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'customerName',
    label: '关联客户',
    align: 'center',
    minWidth: 200,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'ordPrice',
    label: '订单总金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.ordPrice ? `${row.ordPrice}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'repaymentPrice',
    label: '已回款金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.repaymentPrice ? `${row.repaymentPrice}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'status',
    label: '发票状态',
    align: 'center',
    minWidth: 130,
    tooltip: row => {
      return row.invoiceMsg
    },
    tooltipVal: row => {
      return selectDictLabel(order_invoice_status.value, row.status)
    }
  },
  {
    show: true,
    prop: 'price',
    label: '已开票金额',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return row.price ? `${row.price}` : '-'
    },
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'ordStatus',
    label: '状态',
    align: 'center',
    minWidth: 140,
    formatter: row => {
      return `${selectDictLabel(order_status.value, row.ordStatus)}${
        row.approvalStatus ? `( ${row.approvalStatus})` : ''
      }`
    }
  },
  {
    show: true,
    prop: 'transactionName',
    label: '销售人员',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'customerCreditCode',
    label: '税号',
    align: 'center',
    minWidth: 200
  },
  {
    show: true,
    prop: 'receiptsDate',
    label: '单据日期',
    align: 'center',
    minWidth: 110
  },
  {
    show: true,
    prop: 'businessType',
    label: '业务板块',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return selectDictLabel(order_business_type.value, row.businessType)
    }
  },
  {
    show: true,
    prop: 'property',
    label: '订单属性',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return selectDictLabel(order_property.value, row.property)
    }
  },
  {
    show: true,
    prop: 'synchronousMsg',
    label: 'A8同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'createTime',
    label: '订单创建时间',
    align: 'center',
    minWidth: 130
  },
  {
    show: true,
    prop: 'approvalTime',
    label: '最新审批时间',
    align: 'center',
    minWidth: 130
  },
  {
    show: true,
    prop: 'source',
    label: '订单来源',
    align: 'center',
    minWidth: 130,
    formatter: row => {
      return selectDictLabel(order_source.value, row.source)
    }
  },
  {
    show: true,
    prop: 'productName',
    label: '产品名称',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'orgName',
    label: '所属公司',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'deptName',
    label: '所属部门',
    align: 'center',
    minWidth: 100
  },
  {
    show: true,
    prop: 'invoiceTypeName',
    label: '发票类型',
    align: 'center',
    minWidth: 100,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'crmMsg',
    label: 'CRM同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'nuonuoMsg',
    label: '诺诺同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  },
  {
    show: false,
    prop: 'aisinoMsg',
    label: '诺企服同步情况',
    align: 'center',
    minWidth: 130,
    showOverflowTooltip: true
  }
]
// 合同监督列表配置
export const CONTRACTSUPERVISIONTABLE = [
  {
    show: true,
    prop: 'contractOrderNumber',
    label: '合同(订单)编号',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'customerCreditCode',
    label: '客户税号',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'customerName',
    label: '客户名称',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'approvalResult',
    label: '审核情况',
    align: 'center',
    width: 160,
    showOverflowTooltip: true,
    tooltip: row => {
      return row.approvalOpinion
    },
    tooltipVal: row => {
      return row.approvalResult
        ? selectDictLabel(supervision_approval.value, row.approvalResult)
        : '未审'
    }
  },
  {
    show: true,
    prop: 'contractList',
    label: '合同上传情况',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'contractRemark',
    label: '备注内容',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'name',
    label: '产品名称',
    align: 'center',
    width: 160,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'serviceDateArr',
    label: '服务时段',
    align: 'center',
    width: 160,
    showOverflowTooltip: true,
    formatter: row => {
      return row.startDate && row.endDate
        ? `${row.startDate}至${row.endDate}`
        : '-'
    }
  },
  {
    show: true,
    prop: 'businessType',
    label: '业务板块',
    align: 'center',
    width: 130,
    showOverflowTooltip: true,
    formatter: row => {
      return selectDictLabel(order_business_type.value, row.businessType)
    }
  },
  {
    show: true,
    prop: 'transactionName',
    label: '销售人',
    align: 'center',
    width: 100,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'mainContactPhone',
    label: '联系电话',
    align: 'center',
    width: 120,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'taxNature',
    label: '纳税人等级',
    align: 'center',
    width: 100,
    showOverflowTooltip: true,
    formatter: row => {
      return selectDictLabel(tax_grade.value, row.taxNature)
    }
  },
  {
    show: true,
    prop: 'deptName',
    label: '归属公司',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'taxdeptName',
    label: '所属税务局',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
  },
  {
    show: true,
    prop: 'price',
    label: '订单金额',
    align: 'center',
    width: 180,
    showOverflowTooltip: true,
    formatter: row => {
      return row.price ? row.price : '-'
    }
  },
  {
    show: true,
    prop: 'receiptsDate',
    label: '制单日期',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
    // formatter: row => {
    //   return parseTime(row.repaymentDeadline, '{y}-{m}-{d}')
    // }
  },
  {
    show: true,
    prop: 'source',
    label: '订单来源',
    align: 'center',
    width: 180,
    showOverflowTooltip: true,
    formatter: row => {
      return selectDictLabel(order_source.value, row.source)
    }
  },
  {
    show: true,
    prop: 'contractRemarkTime',
    label: '合同备注日期',
    align: 'center',
    width: 180,
    showOverflowTooltip: true
    // formatter: row => {
    //   return parseTime(row.repaymentDeadline, '{y}-{m}-{d}')
    // }
  }
]
